<?php

/*

  Action	$5

  The player to your left reveals then discards the top 2 cards of his deck.
  For each differently named card revealed, if it is an Action Card; +2 Actions; Treasure Card; +$2; Victory Card; +2 Cards.

 */

class Tribute extends Card implements iAction, iKingdom, iIntrigue {

    public function __construct() {
        parent::__construct("Tribute", 5);
        $this->undoPlay = false;
        $this->undoBuy = true;
    }

    public function getDescription() {
        return array(
            "The player to your left reveals then discards the top 2 cards of his deck.  For each differently named card revealed, if it is an Action Card; +2 Actions; Treasure Card; +$2; Victory Card; +2 Cards.");
    }
    
    public function play(Game $game, $isRealCard) {
        $nextPlayerName = $game->getNextPlayerName();
        $cards = $game->removeCardsFromDrawDeck(2, $nextPlayerName);
         ScreenDisplay::addScreenMessage($game, true, "reveal " . nicePrint($cards), "reveals " . ScreenDisplay::$LMSG, $nextPlayerName);

        $unique = getUniqueCards($cards);
        foreach ($unique as $card) {
            if ($card instanceof iAction) {
                $game->addActions(2);
                 ScreenDisplay::addScreenMessage($game, true, "get +2 actions ","gets +2 actions");
            }

            if ($card instanceof iTreasure) {
                $game->addMoney(new Price(2));
                 ScreenDisplay::addScreenMessage($game, true, "get +2$ ","gets +2$");
            }

            if ($card instanceof iVictory) {
                $drawed_cards =$game->drawCards(2);
                 ScreenDisplay::addScreenMessage($game, true, "draw  ".  nicePrint($drawed_cards),"draws ".  sizeof($drawed_cards). " cards");
            }
        }
        $game->discardTempDiscardCards($cards, $nextPlayerName);
		$game->cardActionFinished();
        return true;
    }

}

?>